package com.yuexinduo.education.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.yuexinduo.education.R;
import com.yuexinduo.baselibrary.base.BaseListAdapter;
import com.yuexinduo.education.bean.HomeStudyBean;

import java.util.List;


public class HomeStudyAdapter extends BaseListAdapter<HomeStudyBean> {
    private Context mContext;
    private List<HomeStudyBean> mList;

    public HomeStudyAdapter(Context context, List<HomeStudyBean> list) {
        super(context, list);
        this.mContext=context;
    }


    @Override
    public View initView(HomeStudyBean homeStudyBean, View convertView, ViewGroup parent, int pos) {
        ViewHolder mViewHolder;
        if (convertView == null){
            convertView = LayoutInflater.from(mContext).inflate(R.layout.item_home_study,parent,false);
            mViewHolder = new ViewHolder();
            mViewHolder.itemStudyLin = (LinearLayout) convertView.findViewById(R.id.item_study_lin);
            mViewHolder.itemStudyName = (TextView) convertView.findViewById(R.id.item_study_name);
            convertView.setTag(mViewHolder);
        }else {
            mViewHolder = (ViewHolder) convertView.getTag();
        }

        mViewHolder.itemStudyName.setText(homeStudyBean.getName());

        return convertView;
    }

    class ViewHolder{
        private LinearLayout itemStudyLin;
        private TextView itemStudyName;
    }
}
